home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
Tickle-4.0 (tcl)
/
src
/
Blessed.c
< prev
next >
Wrap
Text File
|
1993-11-18
|
2KB
|
66 lines
/*
** This source code was written by Tim Endres
** Email: time@ice.com.
** USMail: 8840 Main Street, Whitmore Lake, MI 48189
**
** Some portions of this application utilize sources
** that are copyrighted by ICE Engineering, Inc., and
** ICE Engineering retains all rights to those sources.
**
** Neither ICE Engineering, Inc., nor Tim Endres,
** warrants this source code for any reason, and neither
** party assumes any responsbility for the use of these
** sources, libraries, or applications. The user of these
** sources and binaries assumes all responsbilities for
** any resulting consequences.
*/
#include <types.h>
#include <files.h>
#include <stdio.h>
#define SysMapRef ( * (short *) 0x0A58 )
#define ROM85 ( * (short *) 0x028E ) /* High bit = 0 (thus, > 0) for ROM $75 and later */
BlessedWD()
{
short sysvref, myerr, wdrefnum, i;
HVolumeParam vparm;
WDPBRec wparm;
Str32 volname;
char *ptr;
if (ROM85 < 0) {
/* We are running on the old 64K ROMs. Return default volume. */
GetVol(volname, &wdrefnum);
return wdrefnum;
}
wdrefnum = 0;
for (ptr=(char *)&vparm,i=0; i<sizeof(HVolumeParam); i++) *(ptr++) = 0;
myerr = GetVRefNum(SysMapRef, &sysvref);
if (myerr == noErr) {
vparm.ioNamePtr = NULL;
vparm.ioVRefNum = sysvref;
vparm.ioVolIndex = 0;
myerr = PBHGetVInfo((HParmBlkPtr)&vparm, false);
if (myerr == noErr) {
wparm.ioNamePtr = NULL;
wparm.ioVRefNum = sysvref;
wparm.ioWDDirID = vparm.ioVFndrInfo[0];
wparm.ioWDProcID = 'ERIK';
myerr = PBOpenWD(&wparm, false);
if (myerr == noErr)
wdrefnum = wparm.ioVRefNum;
}
}
return wdrefnum;
}
BlessedPath(path_str)
char *path_str;
{
pathname(path_str, BlessedWD());
}